Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/web/app/console/credentials/new/[kind]/page.tsx
blob: 22e8aca435fa750ea18e6588e281be0995cec43a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
// SPDX-License-Identifier: AGPL-3.0-or-later

import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { CredentialsShell } from "@/components/credentials/CredentialsShell";
import { NewToken } from "@/components/credentials/NewToken";
import { isApplicationKind } from "@/lib/credentials";
import { getCredentialsMessages } from "@/lib/credentials-messages";
import { getLocale } from "@/lib/locale.server";

export async function generateMetadata(): Promise<Metadata> {
  return { title: getCredentialsMessages(await getLocale()).metadata.newToken };
}

interface NewTokenFormPageProps {
  params: Promise<{ kind: string }>;
}

/** The second step of a new token: the form of the chosen type. */
export default async function NewTokenFormPage({
  params,
}: NewTokenFormPageProps) {
  const { kind } = await params;
  if (!isApplicationKind(kind)) {
    notFound();
  }
  const locale = await getLocale();
  const { kinds, portal, common } = getCredentialsMessages(locale);
  return (
    <CredentialsShell
      eyebrow={`${portal.newToken} · ${kinds[kind].title}`}
      title={kinds[kind].title}
      description={kinds[kind].description}
      locale={locale}
      site="console"
    >
      <NewToken locale={locale} kind={kind} />
      <p className="credentials-footnote">
        <a href="/credentials/new">{common.back}</a>
      </p>
    </CredentialsShell>
  );
}